Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Next.js 12 se rompe cuando se usa con theme-ui dando "código: 'ERR_REQUIRE_ESM'"

Estoy usando Next.js 12 y aparece este error después de crear un tema usando theme-ui

ingrese la descripción de la imagen aquí

 Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: E:\fm-nextjs\node_modules\@mdx-js\react\index.js require() of ES modules is not supported. require() of E:\fm-nextjs\node_modules\@mdx-js\react\index.js from E:\fm-nextjs\node_modules\@theme-ui\mdx\dist\theme-ui-mdx.cjs.dev.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from E:\fm-nextjs\node_modules\@mdx-js\react\package.json. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module._load (internal/modules/cjs/loader.js:778:12) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at Object.<anonymous> (E:\fm-nextjs\node_modules\@theme-ui\mdx\dist\theme-ui-mdx.cjs.dev.js:9:15) at Module._compile (internal/modules/cjs/loader.js:1072:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module._load (internal/modules/cjs/loader.js:778:12) { code: 'ERR_REQUIRE_ESM' }

mi paquete.json tiene las siguientes dependencias

 "dependencies": { "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@mdx-js/react": "^2.0.0", "@theme-ui/presets": "^0.13.1", "next": "^12.0.10", "react": "^17.0.2", "react-dom": "^17.0.2", "theme-ui": "^0.13.1" }

Intenté eliminar "type": "module" de E:\fm-nextjs\node_modules\@mdx-js\react\package.json , pero seguía dando errores.
¿Cómo soluciono esto realmente? Parece que tengo que cambiar manualmente un montón de archivos. Sería genial si hay una solución.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Rebajar @mdx-js/react a 1.6.22

Por lo general, en este tipo de escenarios, es bueno comenzar a degradar los últimos paquetes instalados (especialmente porque @mdx-js parece haber tenido un aumento de versión importante)

over 4 years ago · Santiago Trujillo Report

0

Es un problema conocido, use el siguiente comando para degradar su @mdx-js/react

 npm i @mdx-js/react@1.6.22
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!